<template>
  <div>
    <el-card>
      <el-form :inline="true">
        <el-form-item label="一级分类">
          <el-select
            v-model="cateStore.c1Id"
            @change="selectC1"
            :disabled="screen != 0"
          >
            <el-option
              v-for="(item, index) in cateStore.c1Arry"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="二级分类">
          <el-select
            v-model="cateStore.c2Id"
            @change="selectC2"
            :disabled="screen != 0"
          >
            <el-option
              v-for="(item, index) in cateStore.c2Arry"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="三级分类">
          <el-select v-model="cateStore.c3Id" :disabled="screen != 0">
            <el-option
              v-for="(item, index) in cateStore.c3Arry"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<script setup lang="ts">
import { onMounted } from 'vue'
import useCateStore from '@/store/modules/cate'
const cateStore = useCateStore()

defineProps(['screen'])

onMounted(() => {
  cateStore.getC1()
})

//下拉框1级改变触发的函数
const selectC1 = () => {
  cateStore.getC2()
}
//下拉框2级改变触发的函数
const selectC2 = () => {
  cateStore.getC3()
}
</script>
<style scoped lang="scss"></style>
